<!--编辑管理员-->
<div class="dialog_content">
	<form id="info_form" action="{:url('Admin/addDo')}" method="post">
		<table width="100%" class="table_form">
			<tr>
				<th width="80">管理员名称 :</th>
				<td><input type="text" name="username" id="J_username" class="input-text" value=""></td>
			</tr>
			<tr>
				<th width="80">所属角色 :</th>
				<td>
					<select name="role_id">
						{volist name="role" id="vo"}
						<option value="{$vo.id}">{$vo.title}</option>
						{/volist}
					</select>
				</td>
			</tr>
			<tr>
				<th>密码 :</th>
				<td><input type="password" name="password" id="J_password" class="input-text"></td>
			</tr>
			<tr>
				<th>确认密码 :</th>
				<td><input type="password" name="repassword" id="J_repassword" class="input-text"></td>
			</tr>
			<tr>
				<th>管理员邮箱 :</th>
				<td><input type="text" name="email" class="input-text" value="" size="30"></td>
			</tr>

		</table>
	</form>
</div>

<script>
	var check_name_url = "{:url('Admin/ajaxCheckName')}";
	$(function(){
		$.formValidator.initConfig({formid:"info_form",autotip:true});

		$("#J_username").formValidator({ onshow:'请填写用户名', onfocus:'请填写用户名'}).inputValidator({ min:1, onerror:'请填写用户名'}).ajaxValidator({type:"get", url:check_name_url, datatype:"html", async:'false', success:function(data){	if( data == "1" ){return true;}else{return false;}}, onerror:'用户名已存在', onwait:'验证中，请稍候...'});
		$("#J_password").formValidator({ empty:true, onshow:'请填写密码', onfocus:'密码长度为6-20之间'}).inputValidator({ min:6, max:20, onerror:'密码应为6-20个字符之间'});
		$("#J_repassword").formValidator({ empty:true, onshow:'请填写确认密码', onfocus:'填写确认密码'}).compareValidator({desid:"J_password",operateor:"=",onerror:'两次密码输入不一致'});

		$('#info_form').ajaxForm({success:complate,dataType:'json'});
		function complate(result){
			if(result.status == 1){
				$.dialog.get(result.dialog).close();
				$.yingloujie.tip({content:result.msg});
				setTimeout(function(){window.location.reload();},1000);
			} else {
				$.yingloujie.tip({content:result.msg, icon:'alert'});
			}
		}
	});
</script>